#include <iostream>
using namespace std;

int arr[500001];

int main()
{
	int n;
	int key;
	cin >> n >> key;
	for(int i = 1; i <= n; i++)
	{
		cin >> arr[i];
	}
	int left = 1;
	int right = n;
	int middle = n/2; 
	
	while(left <= right)
	{
		if(key > arr[middle])
		{
			left = middle+1;
			middle = (right + left)/2;
		}
		else if(key < arr[middle])
		{
			right = middle-1;
			middle = (right + left)/2;
		}
		else
		{
			cout << middle << endl;
			return 0;
		}
	}
	cout << "-1" << endl;
	return 0;
}
